package xyz.erupt.flow.bean.entity.erupt;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.DateType;
import xyz.erupt.annotation.sub_field.sub_edit.Search;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.*;
import java.util.Date;

/**
 * @author PP
 * @version 1.0
 * @project erupt-flow
 * @description 表单打印数据保存
 * @date 2024/10/12 15:52:29
 */
@Erupt(
        name = "打印管理"
        , power = @Power(export = true, add = false, edit = false)
        , orderBy = "EruptPrint.create_time desc"
)
@Table(name = "oa_print")
@TableName("oa_print")
@Entity
@Data
public class EruptPrint extends BaseModel {
    @Id
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "native")
    @Column(name = "id")
    @EruptField
    @TableId(type = IdType.AUTO)
    private Long id;
    //审批编号
    @EruptField(
            views =  @View(
                    title = "审批编号"
            ),
            edit = @Edit(
                    title = "审批编号",
                    search=@Search,
                    readonly = @Readonly
            )
    )
    @Lob
    private String code;

    @EruptField(
            views = @View(
                    title = "流程名称"
            ),
            edit = @Edit(
                    title = "流程名称",
                    search = @Search,
                    readonly = @Readonly
            )
    )
    private String process_name;
   //表单内容
    @EruptField(
            views =  @View(
                    title = "打印内容",
                    type = ViewType.HTML
            )
    )
    @Lob
    private String form;


    @EruptField(
            views = {@View(
                    title = "提交人",
                    width = "100px"
            )},
            edit =
                    @Edit(
                            title = "提交人",
                            search = @Search,
                            readonly = @Readonly
                    )

    )
    private String start_user;

    @EruptField(
            views = {@View(
                    title = "打印人",
                    width = "100px"
            )},
            edit = @Edit(
                    title = "打印人",
                    search = @Search,
                    readonly = @Readonly
            )
    )
    private String print_user;

    @EruptField(
            views = {@View(
                    title = "创建时间",
                    sortable = true
            )},
            edit = @Edit(
                    title = "创建时间",
                    readonly = @Readonly,
                    search = @Search,
                    dateType = @DateType(
                            type = DateType.Type.DATE_TIME
                    )
            )
    )
    private Date create_time;

    @EruptField(
            views = {@View(
                    title = "识别码",
                    width = "100px"
            )},
            edit = @Edit(
                    title = "识别码",
                    search = @Search,
                    readonly = @Readonly
            )
    )
    private String guid;
}
